# 61. 石头剪刀布游戏
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let obj = {};
rl.on('line', function(line) {
const [id, shape] = line.split(' ');
obj[shape] = obj[shape] || [];
obj[shape].push(id);
});
rl.on('close', () => {
const shapes = Object.keys(obj);
if (shapes.length !==2) {
console.log('NULL');
return;
}
let winids = [];
if (obj['A'] && obj['B']) {
winids = obj["A"];
} else if (obj['B'] && obj['C']) {
winids = obj['B'];
} else if (obj['A'] && obj['C']) {
winids = obj['C'];
} else {
console.log('NULL');
}
winids.sort();
winids.forEach(id => console.log(id));
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30